<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../jquery.min.js"></script>
    <script>
        $(function () {
            var targetObj = {
                id: 1,
                msg: {
                    age: 1
                }
            };
            var obj = {
                id: 2,
               
                name: "andy",
                msg: {
                    age: 13
                }
            }
            $.extend(true, targetObj, obj);
            console.log(targetObj);

        })
    </script>
</head>

<body>

</body>

</html>